\(\int \frac {\sec (c+d x)}{(a+b \tan ^2(c+d x))^2} \, dx\) [465]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [F(-2)]
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 94 \[ \int \frac {\sec (c+d x)}{\left (a+b \tan ^2(c+d x)\right )^2} \, dx=\frac {(2 a-b) \text {arctanh}\left (\frac {\sqrt {a-b} \sin (c+d x)}{\sqrt {a}}\right )}{2 a^{3/2} (a-b)^{3/2} d}-\frac {b \sin (c+d x)}{2 a (a-b) d \left (a-(a-b) \sin ^2(c+d x)\right )} \]

[Out]

1/2*(2*a-b)*arctanh(sin(d*x+c)*(a-b)^(1/2)/a^(1/2))/a^(3/2)/(a-b)^(3/2)/d-1/2*b*sin(d*x+c)/a/(a-b)/d/(a-(a-b)*
sin(d*x+c)^2)

Rubi [A] (verified)

Time = 0.10 (sec) , antiderivative size = 94, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3757, 393, 214} \[ \int \frac {\sec (c+d x)}{\left (a+b \tan ^2(c+d x)\right )^2} \, dx=\frac {(2 a-b) \text {arctanh}\left (\frac {\sqrt {a-b} \sin (c+d x)}{\sqrt {a}}\right )}{2 a^{3/2} d (a-b)^{3/2}}-\frac {b \sin (c+d x)}{2 a d (a-b) \left (a-(a-b) \sin ^2(c+d x)\right )} \]

[In]

Int[Sec[c + d*x]/(a + b*Tan[c + d*x]^2)^2,x]

[Out]

((2*a - b)*ArcTanh[(Sqrt[a - b]*Sin[c + d*x])/Sqrt[a]])/(2*a^(3/2)*(a - b)^(3/2)*d) - (b*Sin[c + d*x])/(2*a*(a
 - b)*d*(a - (a - b)*Sin[c + d*x]^2))

Rule 214

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x/Rt[-a/b, 2]], x] /; FreeQ[{a, b},
x] && NegQ[a/b]

Rule 393

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[(-(b*c - a*d))*x*((a + b*x^n)^(p
 + 1)/(a*b*n*(p + 1))), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(a*b*n*(p + 1)), Int[(a + b*x^n)^(p + 1), x], x]
 /; FreeQ[{a, b, c, d, n, p}, x] && NeQ[b*c - a*d, 0] && (LtQ[p, -1] || ILtQ[1/n + p, 0])

Rule 3757

Int[sec[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^(n_))^(p_.), x_Symbol] :> With[{ff = F
reeFactors[Sin[e + f*x], x]}, Dist[ff/f, Subst[Int[ExpandToSum[b*(ff*x)^n + a*(1 - ff^2*x^2)^(n/2), x]^p/(1 -
ff^2*x^2)^((m + n*p + 1)/2), x], x, Sin[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f}, x] && IntegerQ[(m - 1)/2] &&
IntegerQ[n/2] && IntegerQ[p]

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \frac {1-x^2}{\left (a-(a-b) x^2\right )^2} \, dx,x,\sin (c+d x)\right )}{d} \\ & = -\frac {b \sin (c+d x)}{2 a (a-b) d \left (a-(a-b) \sin ^2(c+d x)\right )}+\frac {(2 a-b) \text {Subst}\left (\int \frac {1}{a+(-a+b) x^2} \, dx,x,\sin (c+d x)\right )}{2 a (a-b) d} \\ & = \frac {(2 a-b) \text {arctanh}\left (\frac {\sqrt {a-b} \sin (c+d x)}{\sqrt {a}}\right )}{2 a^{3/2} (a-b)^{3/2} d}-\frac {b \sin (c+d x)}{2 a (a-b) d \left (a-(a-b) \sin ^2(c+d x)\right )} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.23 (sec) , antiderivative size = 114, normalized size of antiderivative = 1.21 \[ \int \frac {\sec (c+d x)}{\left (a+b \tan ^2(c+d x)\right )^2} \, dx=\frac {-\frac {1}{2} (2 a-b) \text {arctanh}\left (\frac {\sqrt {a-b} \sin (c+d x)}{\sqrt {a}}\right ) (a+b+(a-b) \cos (2 (c+d x)))+\sqrt {a} \sqrt {a-b} b \sin (c+d x)}{2 a^{3/2} (a-b)^{3/2} d \left (-a+(a-b) \sin ^2(c+d x)\right )} \]

[In]

Integrate[Sec[c + d*x]/(a + b*Tan[c + d*x]^2)^2,x]

[Out]

(-1/2*((2*a - b)*ArcTanh[(Sqrt[a - b]*Sin[c + d*x])/Sqrt[a]]*(a + b + (a - b)*Cos[2*(c + d*x)])) + Sqrt[a]*Sqr
t[a - b]*b*Sin[c + d*x])/(2*a^(3/2)*(a - b)^(3/2)*d*(-a + (a - b)*Sin[c + d*x]^2))

Maple [A] (verified)

Time = 0.92 (sec) , antiderivative size = 102, normalized size of antiderivative = 1.09

method result size
derivativedivides \(\frac {\frac {b \sin \left (d x +c \right )}{2 a \left (a -b \right ) \left (\sin \left (d x +c \right )^{2} a -b \sin \left (d x +c \right )^{2}-a \right )}+\frac {\left (2 a -b \right ) \operatorname {arctanh}\left (\frac {\left (a -b \right ) \sin \left (d x +c \right )}{\sqrt {a \left (a -b \right )}}\right )}{2 a \left (a -b \right ) \sqrt {a \left (a -b \right )}}}{d}\) \(102\)
default \(\frac {\frac {b \sin \left (d x +c \right )}{2 a \left (a -b \right ) \left (\sin \left (d x +c \right )^{2} a -b \sin \left (d x +c \right )^{2}-a \right )}+\frac {\left (2 a -b \right ) \operatorname {arctanh}\left (\frac {\left (a -b \right ) \sin \left (d x +c \right )}{\sqrt {a \left (a -b \right )}}\right )}{2 a \left (a -b \right ) \sqrt {a \left (a -b \right )}}}{d}\) \(102\)
risch \(\frac {i b \left ({\mathrm e}^{3 i \left (d x +c \right )}-{\mathrm e}^{i \left (d x +c \right )}\right )}{a d \left (-a +b \right ) \left (-a \,{\mathrm e}^{4 i \left (d x +c \right )}+b \,{\mathrm e}^{4 i \left (d x +c \right )}-2 a \,{\mathrm e}^{2 i \left (d x +c \right )}-2 b \,{\mathrm e}^{2 i \left (d x +c \right )}-a +b \right )}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+\frac {2 i a \,{\mathrm e}^{i \left (d x +c \right )}}{\sqrt {a^{2}-a b}}-1\right )}{2 \sqrt {a^{2}-a b}\, \left (a -b \right ) d}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+\frac {2 i a \,{\mathrm e}^{i \left (d x +c \right )}}{\sqrt {a^{2}-a b}}-1\right ) b}{4 \sqrt {a^{2}-a b}\, \left (a -b \right ) d a}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {2 i a \,{\mathrm e}^{i \left (d x +c \right )}}{\sqrt {a^{2}-a b}}-1\right )}{2 \sqrt {a^{2}-a b}\, \left (a -b \right ) d}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {2 i a \,{\mathrm e}^{i \left (d x +c \right )}}{\sqrt {a^{2}-a b}}-1\right ) b}{4 \sqrt {a^{2}-a b}\, \left (a -b \right ) d a}\) \(330\)

[In]

int(sec(d*x+c)/(a+b*tan(d*x+c)^2)^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(1/2*b/a/(a-b)*sin(d*x+c)/(sin(d*x+c)^2*a-b*sin(d*x+c)^2-a)+1/2*(2*a-b)/a/(a-b)/(a*(a-b))^(1/2)*arctanh((a
-b)*sin(d*x+c)/(a*(a-b))^(1/2)))

Fricas [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 337, normalized size of antiderivative = 3.59 \[ \int \frac {\sec (c+d x)}{\left (a+b \tan ^2(c+d x)\right )^2} \, dx=\left [\frac {{\left ({\left (2 \, a^{2} - 3 \, a b + b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, a b - b^{2}\right )} \sqrt {a^{2} - a b} \log \left (-\frac {{\left (a - b\right )} \cos \left (d x + c\right )^{2} - 2 \, \sqrt {a^{2} - a b} \sin \left (d x + c\right ) - 2 \, a + b}{{\left (a - b\right )} \cos \left (d x + c\right )^{2} + b}\right ) - 2 \, {\left (a^{2} b - a b^{2}\right )} \sin \left (d x + c\right )}{4 \, {\left ({\left (a^{5} - 3 \, a^{4} b + 3 \, a^{3} b^{2} - a^{2} b^{3}\right )} d \cos \left (d x + c\right )^{2} + {\left (a^{4} b - 2 \, a^{3} b^{2} + a^{2} b^{3}\right )} d\right )}}, -\frac {{\left ({\left (2 \, a^{2} - 3 \, a b + b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, a b - b^{2}\right )} \sqrt {-a^{2} + a b} \arctan \left (\frac {\sqrt {-a^{2} + a b} \sin \left (d x + c\right )}{a}\right ) + {\left (a^{2} b - a b^{2}\right )} \sin \left (d x + c\right )}{2 \, {\left ({\left (a^{5} - 3 \, a^{4} b + 3 \, a^{3} b^{2} - a^{2} b^{3}\right )} d \cos \left (d x + c\right )^{2} + {\left (a^{4} b - 2 \, a^{3} b^{2} + a^{2} b^{3}\right )} d\right )}}\right ] \]

[In]

integrate(sec(d*x+c)/(a+b*tan(d*x+c)^2)^2,x, algorithm="fricas")

[Out]

[1/4*(((2*a^2 - 3*a*b + b^2)*cos(d*x + c)^2 + 2*a*b - b^2)*sqrt(a^2 - a*b)*log(-((a - b)*cos(d*x + c)^2 - 2*sq
rt(a^2 - a*b)*sin(d*x + c) - 2*a + b)/((a - b)*cos(d*x + c)^2 + b)) - 2*(a^2*b - a*b^2)*sin(d*x + c))/((a^5 -
3*a^4*b + 3*a^3*b^2 - a^2*b^3)*d*cos(d*x + c)^2 + (a^4*b - 2*a^3*b^2 + a^2*b^3)*d), -1/2*(((2*a^2 - 3*a*b + b^
2)*cos(d*x + c)^2 + 2*a*b - b^2)*sqrt(-a^2 + a*b)*arctan(sqrt(-a^2 + a*b)*sin(d*x + c)/a) + (a^2*b - a*b^2)*si
n(d*x + c))/((a^5 - 3*a^4*b + 3*a^3*b^2 - a^2*b^3)*d*cos(d*x + c)^2 + (a^4*b - 2*a^3*b^2 + a^2*b^3)*d)]

Sympy [F]

\[ \int \frac {\sec (c+d x)}{\left (a+b \tan ^2(c+d x)\right )^2} \, dx=\int \frac {\sec {\left (c + d x \right )}}{\left (a + b \tan ^{2}{\left (c + d x \right )}\right )^{2}}\, dx \]

[In]

integrate(sec(d*x+c)/(a+b*tan(d*x+c)**2)**2,x)

[Out]

Integral(sec(c + d*x)/(a + b*tan(c + d*x)**2)**2, x)

Maxima [F(-2)]

Exception generated. \[ \int \frac {\sec (c+d x)}{\left (a+b \tan ^2(c+d x)\right )^2} \, dx=\text {Exception raised: ValueError} \]

[In]

integrate(sec(d*x+c)/(a+b*tan(d*x+c)^2)^2,x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(b-a>0)', see `assume?` for mor
e details)Is

Giac [A] (verification not implemented)

none

Time = 0.57 (sec) , antiderivative size = 112, normalized size of antiderivative = 1.19 \[ \int \frac {\sec (c+d x)}{\left (a+b \tan ^2(c+d x)\right )^2} \, dx=-\frac {\frac {{\left (2 \, a - b\right )} \arctan \left (\frac {a \sin \left (d x + c\right ) - b \sin \left (d x + c\right )}{\sqrt {-a^{2} + a b}}\right )}{{\left (a^{2} - a b\right )} \sqrt {-a^{2} + a b}} - \frac {b \sin \left (d x + c\right )}{{\left (a \sin \left (d x + c\right )^{2} - b \sin \left (d x + c\right )^{2} - a\right )} {\left (a^{2} - a b\right )}}}{2 \, d} \]

[In]

integrate(sec(d*x+c)/(a+b*tan(d*x+c)^2)^2,x, algorithm="giac")

[Out]

-1/2*((2*a - b)*arctan((a*sin(d*x + c) - b*sin(d*x + c))/sqrt(-a^2 + a*b))/((a^2 - a*b)*sqrt(-a^2 + a*b)) - b*
sin(d*x + c)/((a*sin(d*x + c)^2 - b*sin(d*x + c)^2 - a)*(a^2 - a*b)))/d

Mupad [B] (verification not implemented)

Time = 12.96 (sec) , antiderivative size = 239, normalized size of antiderivative = 2.54 \[ \int \frac {\sec (c+d x)}{\left (a+b \tan ^2(c+d x)\right )^2} \, dx=-\frac {\left (a^2\,\mathrm {atanh}\left (\frac {\sin \left (c+d\,x\right )\,\sqrt {a-b}}{\sqrt {a}}\right )\,1{}\mathrm {i}-\frac {b^2\,\mathrm {atanh}\left (\frac {\sin \left (c+d\,x\right )\,\sqrt {a-b}}{\sqrt {a}}\right )\,1{}\mathrm {i}}{2}+a^2\,\cos \left (2\,c+2\,d\,x\right )\,\mathrm {atanh}\left (\frac {\sin \left (c+d\,x\right )\,\sqrt {a-b}}{\sqrt {a}}\right )\,1{}\mathrm {i}+\frac {b^2\,\cos \left (2\,c+2\,d\,x\right )\,\mathrm {atanh}\left (\frac {\sin \left (c+d\,x\right )\,\sqrt {a-b}}{\sqrt {a}}\right )\,1{}\mathrm {i}}{2}+\frac {a\,b\,\mathrm {atanh}\left (\frac {\sin \left (c+d\,x\right )\,\sqrt {a-b}}{\sqrt {a}}\right )\,1{}\mathrm {i}}{2}-\frac {a\,b\,\cos \left (2\,c+2\,d\,x\right )\,\mathrm {atanh}\left (\frac {\sin \left (c+d\,x\right )\,\sqrt {a-b}}{\sqrt {a}}\right )\,3{}\mathrm {i}}{2}-\sqrt {a}\,b\,\sin \left (c+d\,x\right )\,\sqrt {a-b}\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{2\,a^{3/2}\,d\,{\left (a-b\right )}^{3/2}\,\left (\frac {a}{2}+\frac {b}{2}+\frac {a\,\cos \left (2\,c+2\,d\,x\right )}{2}-\frac {b\,\cos \left (2\,c+2\,d\,x\right )}{2}\right )} \]

[In]

int(1/(cos(c + d*x)*(a + b*tan(c + d*x)^2)^2),x)

[Out]

-((a^2*atanh((sin(c + d*x)*(a - b)^(1/2))/a^(1/2))*1i - (b^2*atanh((sin(c + d*x)*(a - b)^(1/2))/a^(1/2))*1i)/2
 + a^2*cos(2*c + 2*d*x)*atanh((sin(c + d*x)*(a - b)^(1/2))/a^(1/2))*1i + (b^2*cos(2*c + 2*d*x)*atanh((sin(c +
d*x)*(a - b)^(1/2))/a^(1/2))*1i)/2 + (a*b*atanh((sin(c + d*x)*(a - b)^(1/2))/a^(1/2))*1i)/2 - (a*b*cos(2*c + 2
*d*x)*atanh((sin(c + d*x)*(a - b)^(1/2))/a^(1/2))*3i)/2 - a^(1/2)*b*sin(c + d*x)*(a - b)^(1/2)*1i)*1i)/(2*a^(3
/2)*d*(a - b)^(3/2)*(a/2 + b/2 + (a*cos(2*c + 2*d*x))/2 - (b*cos(2*c + 2*d*x))/2))